#pragma once

#ifndef METAXMLHANDLER_H
#define METAXMLHANDLER_H

#include <list>
#include <string>

#include <comdef.h>
#include <atlbase.h>
#include <msxml.h>
#include <iostream>

#include "Action.h"
#include "EventScheme.h"

class INFOBUS_API MetaXmlHandler
{
public:
  MetaXmlHandler(const char* xml);
  ~MetaXmlHandler();

  bool testXml();
  const char* toXml();
  const char* toXml(const char* expr);
  const char* getNodeValue(const char* pszExpr);
  const char* getAttrValue(const char* pszExpr, const char* pszAttrName);
  std::list<std::string>& getNodeValues(const char* pszExpr, std::list<std::string>& liNodeNames);
  void getActionSteps(std::list<Step*>& list);
  void getActionTraces(std::list<Trace*>& list);
  const char* testXmlEx(const char* expr);  
  long getNodeCount(const char* pszExpr);
private:
  CComPtr<IXMLDOMDocument> m_spXMLDOMDoc; 
  VARIANT_BOOL bSuccess;
  bool m_bXmlValid;
  HRESULT hr;
  BSTR str;
};


#endif